﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:EIA.SLClient.ProjectManage.Basic"
	xmlns:EIA_SLClient_Utility_Controls="clr-namespace:EIA.SLClient.Utility.Controls;assembly=EIA.SLClient.Utility" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:EIA_SLClient_Utility_Behaviors="clr-namespace:EIA.SLClient.Utility.Behaviors;assembly=EIA.SLClient.Utility"
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	mc:Ignorable="d"
	x:Class="EIA.SLClient.ProjectManage.Basic.QueryBoxView"
	d:DesignWidth="530" d:DesignHeight="30">
	<UserControl.Resources>
		<local:QueryBoxViewModel x:Key="QueryBoxViewModelDataSource" />
		<ControlTemplate x:Key="ValidationToolTipTemplate">
			<Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
				<Grid.RenderTransform>
					<TranslateTransform x:Name="xform" X="-25"/>
				</Grid.RenderTransform>
				<VisualStateManager.VisualStateGroups>
					<VisualStateGroup x:Name="OpenStates">
						<VisualStateGroup.Transitions>
							<VisualTransition GeneratedDuration="0"/>
							<VisualTransition GeneratedDuration="0:0:0.2" To="Open">
								<Storyboard>
									<DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
										<DoubleAnimation.EasingFunction>
											<BackEase Amplitude=".3" EasingMode="EaseOut"/>
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
									<DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
								</Storyboard>
							</VisualTransition>
						</VisualStateGroup.Transitions>
						<VisualState x:Name="Closed">
							<Storyboard>
								<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
							</Storyboard>
						</VisualState>
						<VisualState x:Name="Open">
							<Storyboard>
								<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
								<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
							</Storyboard>
						</VisualState>
					</VisualStateGroup>
				</VisualStateManager.VisualStateGroups>
				<Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
				<Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
				<Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
				<Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
				<Border Background="#FFDC000C" CornerRadius="2"/>
				<Border CornerRadius="2">
					<TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
				</Border>
			</Grid>
		</ControlTemplate>
		<Style x:Key="tbs_clear" TargetType="TextBox">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="Foreground" Value="#FF000000"/>
			<Setter Property="Padding" Value="2"/>
			<Setter Property="BorderBrush">
				<Setter.Value>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFA3AEB9" Offset="0"/>
						<GradientStop Color="#FF8399A9" Offset="0.375"/>
						<GradientStop Color="#FF718597" Offset="0.375"/>
						<GradientStop Color="#FF617584" Offset="1"/>
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="TextBox">
						<Grid x:Name="RootElement">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="ReadOnly"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused"/>
									<VisualState x:Name="Unfocused"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="ValidationStates">
									<VisualState x:Name="Valid"/>
									<VisualState x:Name="InvalidUnfocused"/>
									<VisualState x:Name="InvalidFocused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1" Opacity="1">
								<ScrollViewer x:Name="ContentElement" BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
							</Border>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
		</Style>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource QueryBoxViewModelDataSource}}">
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
			<ColumnDefinition Width="48"/>
		</Grid.ColumnDefinitions>
		<EIA_SLClient_Utility_Controls:ContentControl4State d:LayoutOverrides="Height" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" VerticalAlignment="Center">
			<EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundPressed>
				<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/输入框-2.png"/>
			</EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundPressed>
			<EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundNormal>
				<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/输入框-1.png"/>
			</EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundNormal>
			<EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundMouseOver>
				<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/输入框-2.png"/>
			</EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundMouseOver>
			<EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundDisabled>
				<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/输入框-1.png" Opacity="0.4"/>
			</EIA_SLClient_Utility_Controls:ContentControl4State.BackgroundDisabled>
			<EIA_SLClient_Utility_Controls:ContentControl4State.Background>
				<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/输入框-1.png"/>
			</EIA_SLClient_Utility_Controls:ContentControl4State.Background>
			<Grid Height="30">
				<TextBox TextWrapping="Wrap" VerticalAlignment="Center" Style="{StaticResource tbs_clear}" Margin="4,0,24,0" Text="{Binding Keyword, Mode=TwoWay}"/>
				<Button Content="" HorizontalAlignment="Right" Width="12" Style="{StaticResource bs_clear}" Height="12" Margin="0,0,8,0" VerticalAlignment="Center">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="Click">
							<ei:ChangePropertyAction TargetObject="{Binding ElementName=grid}" PropertyName="Visibility">
								<ei:ChangePropertyAction.Value>
									<Visibility>Visible</Visibility>
								</ei:ChangePropertyAction.Value>
							</ei:ChangePropertyAction>
						</i:EventTrigger>
					</i:Interaction.Triggers>
					<Button.Background>
						<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/V-1.png"/>
					</Button.Background>
					<i:Interaction.Behaviors>
						<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
							<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/V-2.png"/>
							</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
							<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/V-1.png"/>
							</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
							<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/V-2.png"/>
							</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
							<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/输入框-1.png" Opacity="0.4"/>
							</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
						</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
					</i:Interaction.Behaviors>
				</Button>
				<Grid Height="0" VerticalAlignment="Bottom" Margin="0">
					<Grid x:Name="grid" Background="#FFE5E5E5" Height="280" Margin="0,0,0,-280" VerticalAlignment="Bottom" Visibility="Collapsed">
						<Grid.Effect>
							<DropShadowEffect BlurRadius="1" ShadowDepth="1" Opacity="0.3"/>
						</Grid.Effect>
						<Rectangle Fill="White" Stroke="#FFDDDDDD"/>
						<Button VerticalAlignment="Top" Margin="0,4,6,0" HorizontalAlignment="Right" Width="16" Height="16" Style="{StaticResource bs_clear}">
							<Button.Background>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/close-1.png"/>
							</Button.Background>
							<i:Interaction.Behaviors>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/close-2.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/close-1.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/close-2.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/close-1.png" Opacity="0.4"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
							</i:Interaction.Behaviors>
							<i:Interaction.Triggers>
								<i:EventTrigger EventName="Click">
									<ei:ChangePropertyAction TargetObject="{Binding ElementName=grid}" PropertyName="Visibility">
										<ei:ChangePropertyAction.Value>
											<Visibility>Collapsed</Visibility>
										</ei:ChangePropertyAction.Value>
									</ei:ChangePropertyAction>
								</i:EventTrigger>
							</i:Interaction.Triggers>
						</Button>
						<local:QueryConditionPanel x:Name="queryConditionPanel" Margin="8,16" d:LayoutOverrides="Width, Height" Conditions="{Binding PlusConditions, Mode=TwoWay}"/>
						<HyperlinkButton Content="条件重置" HorizontalAlignment="Left" VerticalAlignment="Top">
							<i:Interaction.Triggers>
								<i:EventTrigger EventName="Click">
									<ei:CallMethodAction TargetObject="{Binding ElementName=queryConditionPanel}" MethodName="Reset"/>
								</i:EventTrigger>
							</i:Interaction.Triggers>
						</HyperlinkButton>
					</Grid>
				</Grid>
			</Grid>
		</EIA_SLClient_Utility_Controls:ContentControl4State>
		<Button Grid.Column="1" Style="{StaticResource bs_clear}" VerticalAlignment="Center" Height="30" Command="{Binding QueryCommand}">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="Click">
					<ei:ChangePropertyAction TargetObject="{Binding ElementName=grid}" PropertyName="Visibility">
						<ei:ChangePropertyAction.Value>
							<Visibility>Collapsed</Visibility>
						</ei:ChangePropertyAction.Value>
					</ei:ChangePropertyAction>
				</i:EventTrigger>
			</i:Interaction.Triggers>
			<Button.Background>
				<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/搜索-1.png"/>
			</Button.Background>
			<i:Interaction.Behaviors>
				<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
					<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
						<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/搜索-2.png"/>
					</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
					<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
						<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/搜索-1.png"/>
					</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
					<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
						<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/搜索-2.png"/>
					</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
					<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
						<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage.Basic;component/assets/img/搜索-1.png" Opacity="0.4"/>
					</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
				</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
			</i:Interaction.Behaviors>
		</Button>
	</Grid>
</UserControl>
